Other than native x86-64 code, the XEN guest *does* use 4k mappings for
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 1 Jul 2005 15:47:46 +0000 (15:47 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 1 Jul 2005 15:47:46 +0000 (15:47 +0000)
the contiguous kernel mapping of (physical) memory. Thus the code in
change_page_attr needs to work like on i386 (where large pages are used
only conditionally) rather than like native x86-64. Patch below/attached.
Not doing so triggered the BUG_ON during load of intel-agp on machines
with i915 chipset.
Signed-off-by: Jan Beulich <JBeulich@novell.com>
linux-2.6.11-xen-sparse/arch/xen/x86_64/mm/pageattr.c

index 63e9a38a17722dec7eecb0f69e573d7ae72b3236..4afb9c26e4d3c69aa01886209dd084170088c6c2 100644 (file)
@@ -166,16 +166,23 @@ __change_page_attr(unsigned long address, unsigned long pfn, pgprot_t prot,
                BUG();
 
        /* on x86-64 the direct mapping set at boot is not using 4k pages */
-       BUG_ON(PageReserved(kpte_page));
-
-       switch (page_count(kpte_page)) {
-       case 1:
-               save_page(address, kpte_page);               
-               revert_page(address, ref_prot);
-               break;
-       case 0:
-               BUG(); /* memleak and failed 2M page regeneration */
-       }
+//     BUG_ON(PageReserved(kpte_page));
+       /*
+        * ..., but the XEN guest kernels (currently) do:
+        * If the pte was reserved, it means it was created at boot
+        * time (not via split_large_page) and in turn we must not
+        * replace it with a large page.
+        */
+       if (!PageReserved(kpte_page)) {
+               switch (page_count(kpte_page)) {
+               case 1:
+                       save_page(address, kpte_page);               
+                       revert_page(address, ref_prot);
+                       break;
+               case 0:
+                       BUG(); /* memleak and failed 2M page regeneration */
+               }
+       }
        return 0;
 }